# This class find dates in a text.
require 'date'
class DateFinder
  DATE_REGEXP = [/((19|20)[0-9]{2}[- \/.](0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01]))/]

  def self.find(text)    
    dates = []
    DATE_REGEXP.each do |regexp|      
      text.scan(regexp).each { |date| dates << DateTime.parse(date[0]) }
    end    
    dates.uniq
  end  
end

